package com.heima.day08;

import java.util.Scanner;

/*
 * 4、【编号：804】 键盘录入一个字符串，统
 * 计该字符串中大写字母字符，小写字母字符，
 * 数字字符出现的次数(不考虑其他字符)
 * */
public class Demo4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("键盘录入一个字符串:");
        String str = sc.nextLine();
        int big = 0;
        int small = 0;
        int num = 0;
        int other = 0;
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] >= 'A' && chars[i] <= 'Z') {
                big++;
            } else if (chars[i] >= 'a' && chars[i] <= 'z') {
                small++;
            } else if (chars[i] >= '0' && chars[i] <= '9') {
                num++;
            } else {
                other++;
            }
        }
        System.out.println("大写字母字符有:" + big);
        System.out.println("小写字母字符有:" + small);
        System.out.println("数字字母字符有:" + num);
        System.out.println("其他字母字符有:" + other);
    }
}
